///////////////////////////////////////////////////////////////////////
//
// NAME:		pid.h
//
// AUTHOR:	Tom Bottiglieri
//
// DATE:		12/18/07
//
// License:		GPL v3.0 (http://www.gnu.org/copyleft/gpl.html)
//
// This file contains declarations and macros for a PID driver
//
///////////////////////////////////////////////////////////////////////

//PID data structure
typedef struct{
  int dState;      	// Last position input
  int iState;      	// Integrator state
  int iMax;  	// Maximum and minimum allowable integrator state
  int div;			//How much to divide gains by
  int	iGain;    	// integral gain
  int   pGain;    	// proportional gain
  int   dGain;     	// derivative gain
} PID;

//Prototypes
char getPID(PID * in, int set_point, int position);
void newPID(PID *in,int p, int i, int d, int i_min, int i_max, int div);
